package com.kb.erp.entity.quote;

import lombok.Data;

import java.util.List;

@Data
public class QuoteVO {

    private String currency;
    //供应商
    private String source;
    //部件编号
    private String mfc;
    //品牌
    private String brand;
    //数量
    private Integer qty;
    //内部零件号
    private String part;
    //库存
    private String inventory;

    //平台数量
    private String priceNum;
    //折扣价价格
    private String price;

    //成本价价格
    private String price2;

    //折扣率
    private String result4;

    //匹配数量
    private String result;
    //匹配折扣价
    private String result1;
    //匹配标准价
    private String result2;
    //子，用于展示树
    private List<QuoteVO> children;

    //规格描述
    private String model;

    private Integer minNum;

    private String venPackage;

    private String eccn;

    private String application;



    // 新增的字段
    private String comb1;
    private String comb2;



    // 计算comb1字段
    public void calculateComb1() {
        StringBuilder sb = new StringBuilder();

        if (mfc != null) sb.append("<b><span style='font-size:14px;'>型号:</span></b><b><span style='font-size:14px;'>").append(mfc).append("</span></b><br/>");
        if (brand != null) sb.append("品牌:").append(brand).append("<br/>");
        if (venPackage != null) sb.append("封装:").append(venPackage).append("<br/>");
        if (model != null) sb.append("描述:").append(model);



        this.comb1 = sb.toString();
    }




    // 计算comb2字段
    public void calculateComb2() {
        StringBuilder sb = new StringBuilder();

        if (inventory != null) sb.append("库存:").append(inventory).append("<br/>");
        if (minNum != null) sb.append("起购量:").append(minNum);



        this.comb2 = sb.toString();
    }






    public void updateCombFields() {
        calculateComb1();
        calculateComb2();

    }





}
